package chapter03
import org.apache.spark.{SparkConf, SparkContext}
object Test04_RDD1 {
  def main(args: Array[String]): Unit = {
    val partitions = new SparkConf().setMaster("local[*]").setAppName("partitions")
    val sc = new SparkContext(partitions)
    val value = sc.makeRDD(List(1, 2, 3, 4, 5))
    //指定分区个数
    val value1 = sc.makeRDD(List(1, 2, 3, 4, 5), 3)
    //取得分区个数
    println(value.getNumPartitions)
    println(value1.getNumPartitions)
    //重新分区
    println(value.repartition(2).getNumPartitions)
  }
}
